The present disclosure relates generally to data handling in digital devices and, more particularly, to a method and system for managing global queues.
In a multi-process or multiprocessor computing environment, queues are often used to share data between processes or processors. It may occur in such an environment that more than one process or processor is attempting to add or remove elements from a queue at the same time. To avoid data errors that may occur during such simultaneous data queue accesses, spinlocks may be used. A spinlock may place a process or processor attempting to access a queue that is currently already being accessed into a busy-wait state until the queue becomes available. However, the use of spinlocks may lead to inefficiencies because only one process may be allowed to access the queue at a given time, regardless of what function the process is performing on the queue. Further inefficiencies may occur since processes and processors may be left in a busy-wait state until the queue is available.
Accordingly, what is needed is an improved method and system of managing access to and performing operations on a queue.